﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace com.huawei.ebg.esdk.ucsdk.client.control
{
    public partial class ChooseMeeting : Button
    {
        public ChooseMeeting()
        {
            InitializeComponent();
        }

        # region 自定义字段

        private string _txtIMMeeting = "即时消息会议";
        [Description("下拉框即时消息会议文本")]
        public string TextIMMeeting
        {
            get { return _txtIMMeeting; }
            set { _txtIMMeeting = value; }
        }

        private string _txtMMMeeting = "语音会议";
        [Description("下拉框语音会议文本")]
        public string TextMMMeeting
        {
            get { return _txtMMMeeting; }
            set { _txtMMMeeting = value; }
        }

        private Image _imgIMMeeting = Properties.Resources.IMMeeting;
        [Description("下拉框即时消息会议图片")]
        public Image IMGIMMeeting
        {
            get { return _imgIMMeeting; }
            set { _imgIMMeeting = value; }
        }

        private Image _imgMMMeeting = Properties.Resources.MMMeeting;
        [Description("下拉框语音会议图片")]
        public Image IMGMMMeeting
        {
            get { return _imgMMMeeting; }
            set { _imgMMMeeting = value; }
        }

        # endregion

        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            try
            {
                ToolStripDropDown dropDown = new ToolStripDropDown();
                //即时消息会议下拉按键设置
                ToolStripButton tsButton = new ToolStripButton();
                tsButton.Text = _txtIMMeeting;
                tsButton.Image = _imgIMMeeting;
                tsButton.Tag = "IMMeeting";
                tsButton.Click += new EventHandler(tsButton_Click);
                dropDown.Items.Add(tsButton);
                //语音会议下拉按键设置
                tsButton = new ToolStripButton();
                tsButton.Text = _txtMMMeeting;
                tsButton.Image = _imgMMMeeting;
                tsButton.Tag = "MMMeeting";
                tsButton.Click += new EventHandler(tsButton_Click);
                dropDown.Items.Add(tsButton);

                //设置ToolStripDropDown弹出位置
                Point location = Utilities.GetClientLocation(this, dropDown);
                dropDown.Show(this, location, ToolStripDropDownDirection.BelowRight);
            }
            catch (Exception ex)
            {
                //throw ex;
            }
        }

        private void tsButton_Click(object sender, EventArgs e)
        {
            try
            {
                switch (((string)((ToolStripButton)sender).Tag))
                {
                    case "IMMeeting":
                        CtrlBusiness.CreateIMMeeting();
                        break;
                    case "MMMeeting":
                        CtrlBusiness.CreateMMMeeting();
                        break;
                    default:
                        break;
                }
            }
            catch (System.Exception ex)
            {
            	
            }
           
        }
    }
}
